package com.sinping.qh.repository.mongo;

import com.sinping.qh.domain.common.UnitDomain;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

/**
 * 单位
 *
 * @author Tiansx
 * @create 2018-05-29 11:33
 **/
public interface UnitRepository extends MongoRepository<UnitDomain,String> {
//    UnitDomain findUnitByUnitName(String UnitName);
    List<UnitDomain>findAllByUnitNameAndStatus(String unitName,String status);

    /**
     * 通过类型查找
     * @param unitType
     * @return
     */
    List<UnitDomain>findAllByUnitType(String unitType);
    List<UnitDomain>findAllByUnitTypeAndStatus(String unitType,String status);
    List<UnitDomain>findAllByStatus(String status);

    List<UnitDomain> findAllByUnitTypeAndIsAutomaticAndStatus(String unitType,String isAutomatic,String status);


    UnitDomain findUnitDomainByIdAndIsAutomaticAndStatus(String id,String isAutomatic,String status);

    UnitDomain findByIdAndStatus(String id,String status);
    UnitDomain findByIdAndStatusOrderByUnitNameAsc(String id,String status);
}
